#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pydantic import BaseModel
from typing import Optional, List, Dict, Any
from datetime import datetime

class RoleBase(BaseModel):
    """角色基础数据模式"""
    name: str
    permissions: List[str]
    description: Optional[str] = None

class RoleCreate(RoleBase):
    """创建角色时的数据模式"""
    pass

class RoleUpdate(BaseModel):
    """更新角色时的数据模式"""
    name: Optional[str] = None
    permissions: Optional[List[str]] = None
    status: Optional[int] = None
    description: Optional[str] = None

class RoleInDB(RoleBase):
    """返回给用户的角色数据模式"""
    id: int
    status: int
    create_time: datetime
    update_time: Optional[datetime] = None
    user_count: Optional[int] = None

    class Config:
        from_attributes = True 